package com.easy.advice;

import com.easy.exception.ServiceException;
import com.easy.util.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ServiceExceptionAdvice {

    @ExceptionHandler(ServiceException.class)
    public Result handle(ServiceException e)
    {
        return Result.error(e.getCode(),e.getMessage());
    }
}
